package utils

import "github.com/gin-gonic/gin"

func ErrorHandler() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Next()
		if length := len(c.Errors); length > 0 {
			c.JSON(500, gin.H{
				"err": c.Errors,
			})
		}
	}
}
